home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / lib / gcc-lib / i486-unknown-sco3.2v5.0.0elf / 2.6-95q2 / include / tcap.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-12  |  9.7 KB  |  306 lines

  1. #ifndef _PARAMS
  2. #if defined(__STDC__) || defined(__cplusplus)
  3. #define _PARAMS(ARGS) ARGS
  4. #else
  5. #define _PARAMS(ARGS) ()
  6. #endif
  7. #endif /* _PARAMS */
  8. /* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */
  9.  
  10.  
  11. #if defined(_NO_PROTOTYPE)    /* Old, crufty environment */
  12. #include <oldstyle/tcap.h>
  13. #elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */
  14. #include <ods_30_compat/tcap.h>
  15. #else     /* Normal, default environment */
  16. /*
  17.  *   Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc.
  18.  *        All Rights Reserved.
  19.  *
  20.  *    The information in this file is provided for the exclusive use of
  21.  *    the licensees of The Santa Cruz Operation, Inc.  Such users have the
  22.  *    right to use, modify, and incorporate this code into other products
  23.  *    for purposes authorized by the license agreement provided they include
  24.  *    this notice and the associated copyright notice with any such product.
  25.  *    The information in this file is provided "AS IS" without warranty.
  26.  */
  27.  
  28. /*
  29.  *    Formerly "curses.h", now only included for termcap curses
  30.  *    (as opposed to terminfo curses).
  31.  */
  32. #if defined(WINDOW) && !defined(_TCAP_H)
  33. #error "Please define WINDOW only via inclusion of tcap.h"
  34. #endif
  35.  
  36. #ifndef    _TCAP_H
  37. #define    _TCAP_H
  38.  
  39. #pragma comment(exestr, "xpg4plus @(#) tcap.h 20.1 94/12/04 ")
  40.  
  41. #pragma   pack(4)
  42.  
  43. #include    <stdio.h>
  44. #include    <termio.h>
  45. #include    <unctrl.h>
  46.  
  47. typedef    struct termio    SGTTY;
  48. typedef    unsigned long    chtype;
  49.  
  50. #define    bool    char
  51. #define    reg    register
  52.  
  53. #define    TRUE    1
  54. #define    FALSE    0
  55. #define    ERR    0
  56. #define    OK    (1)
  57.  
  58. #define    _ENDLINE    001
  59. #define    _FULLWIN    002
  60. #define    _SCROLLWIN    004
  61. #define    _FLUSH        010
  62. #define    _CUROFF        020
  63. #define    _VSCROLL    040
  64.  
  65. #define A_CHARTEXT    0x00ff
  66. #define    A_ATTRIBUTES    0xff00
  67. #define    A_STANDOUT    0x0100
  68. #define    A_BLINK        0x0200
  69. #define    A_UNDERLINE    0x0400
  70. #define A_ATTR4        0x0800        /* USER DEFINED  */
  71. #define A_ATTR5        0x1000        /* USER DEFINED  */
  72. #define A_ATTR6        0x2000        /* USER DEFINED  */
  73. #define A_ATTR7        0x4000        /* USER DEFINED  */
  74. #define A_ATTR8        0x8000        /* USER DEFINED  */
  75.  
  76. /* for compatibility  */
  77.  
  78. #define _ATTRIBUTE    A_ATTRIBUTES
  79. #define _STANDOUT    A_STANDOUT    /* STANDOUT  */
  80. #define _BLINK        A_BLINK        /* BLINK     */
  81. #define _UNDERLIN    A_UNDERLINE    /* UNDERLINE  */
  82. #define ATTR1        A_STANDOUT    /* STANDOUT  */
  83. #define ATTR2        A_BLINK        /* BLINK     */
  84. #define ATTR3        A_UNDERLINE    /* UNDERLINE  */
  85. #define ATTR4        A_ATTR4
  86. #define ATTR5        A_ATTR5
  87. #define ATTR6        A_ATTR6
  88. #define ATTR7        A_ATTR7
  89. #define ATTR8        A_ATTR8
  90.  
  91. #define    _NOCHANGE    (-1)
  92. #define    _DELETE        (-1 & 0x8000)
  93. #define    _INSERT        (-1 & 0xC000)
  94. #define _INSDEL        (-1 & 0xE000)
  95.  
  96. #define    _puts(s)    tputs(s, 1, tputch)      
  97.  
  98. /*
  99.  * Capabilities from termcap
  100.  */
  101.  
  102. #if __cplusplus
  103. extern "C" {
  104. #endif /* __cplusplus  */
  105.  
  106. extern bool     AM, BS, CA, DA, DB, EO, GT, HZ, IN, MI, MS, NC, OS, UL,
  107.         XN, XS;        
  108. extern char     *KK1, *KK2, *KK3, *KK4, *KK5, *AL,  *BC,  *BL,  *BT,  *CD,
  109.         *CE,  *CF,  *CL,  *CM,  *CO,  *CR,  *DC,  *DL,  *DM,  *DO,
  110.         *ED,  *EI,  *EN,  *HO,  *IC,  *IM,  *IP,  *K0,  *K1,  *K2, *K3,
  111.         *K4,  *K5,  *K6,  *K7,  *K8,  *K9,  *KAA, *KCC, *KDD, *KEE,
  112.         *KFF, *KHH, *KII, *KLL, *KMM, *KNN, *KPP, *KRR, *KSS, *KTT,
  113.         *KA,  *KB,  *KD,  *KE,  *KH,  *KL,  *KR,  *KS,  *KT,  *KU,
  114.         *LL,  *MA,  *MB,  *ME,  *ND,  *NL,  *SE,  *SF,  *SO,  *SR,
  115.         *TA,  *TE,  *TI,  *UC,  *UE,  *UP,  *US,  *VB,  *VE,  *VS,
  116.         *BB,  *BE,   PC;
  117. extern char    *A4S, *A4E,*A5S, *A5E, *A6S, *A6E, *A7S, *A7E, *A8S, *A8E;
  118. extern int    A4G, A5G, A6G, A7G, A8G, SG, UG;                
  119.  
  120. /*
  121.  * From the tty modes...
  122.  */
  123.  
  124. extern bool    NONL, UPPERCASE, normtty, _pfast;
  125. #if __cplusplus
  126. };
  127. #endif /* __cplusplus  */
  128.  
  129. struct _win_st {
  130.     short        _cury, _curx;
  131.     short        _maxy, _maxx;
  132.     short        _begy, _begx;
  133.     short        _flags;
  134.     bool        _clear;
  135.     bool        _leave;
  136.     bool        _scroll;
  137.     bool        _keypad;            /* Sys V Release 2  */
  138.     short        **_y;
  139.     short        *_ybase;
  140.     short        *_firstch;
  141.     short        *_lastch;
  142.     struct _win_st    *_nextp, *_orig;
  143. };
  144.  
  145. #define    WINDOW    struct _win_st
  146.  
  147. #if __cplusplus
  148. extern "C" {
  149. #endif /* __cplusplus  */
  150.  
  151. extern WINDOW    *initscr(), *newwin _PARAMS((int, int, int, int)), *subwin _PARAMS((WINDOW *, int, int, int, int));
  152. extern char    *longname(), *getcap();
  153.  
  154. extern bool    My_term, _echoit, _rawmode, _kpadmode, _endwin;    
  155.  
  156. extern char    *Def_term, ttytype[];
  157.  
  158. extern int    LINES, COLS, _tty_ch, _res_flg;
  159.  
  160. extern SGTTY    _tty;
  161.  
  162. extern WINDOW    *stdscr, *curscr;
  163.  
  164. #if __cplusplus
  165. };
  166. #endif /* __cplusplus  */
  167.  
  168. /*
  169.  *    Define CURVOID to stop lint from generating "null effect"
  170.  *     comments.
  171.  */
  172. #ifdef __lint
  173. int    __void__;
  174. #define    CURVOID(x)    (__void__ = (int) (x))
  175. #else
  176. #define    CURVOID(x)    (x)
  177. #endif
  178.  
  179. /*
  180.  * psuedo functions for standard screen
  181.  */
  182. #define    addch(ch)    CURVOID(waddch(stdscr, ch))
  183. #define    getch()        CURVOID(wgetch(stdscr))
  184. #define    addstr(str)    CURVOID(waddstr(stdscr, str))
  185. #define    getstr(str)    CURVOID(wgetstr(stdscr, str))
  186. #define    move(y, x)    CURVOID(wmove(stdscr, y, x))
  187. #define    clear()        CURVOID(wclear(stdscr))
  188. #define    erase()        CURVOID(werase(stdscr))
  189. #define    clrtobot()    CURVOID(wclrtobot(stdscr))
  190. #define    clrtoeol()    CURVOID(wclrtoeol(stdscr))
  191. #define    insertln()    CURVOID(winsertln(stdscr))
  192. #define    deleteln()    CURVOID(wdeleteln(stdscr))
  193. #define    refresh()    CURVOID(wrefresh(stdscr))
  194. #define    inch()        CURVOID(winch(stdscr))
  195. #define    insch(c)    CURVOID(winsch(stdscr,c))
  196. #define    delch()        CURVOID(wdelch(stdscr))
  197.  
  198. #define    attron(a)    CURVOID(wattron(stdscr,a))
  199. #define    attroff(a)    CURVOID(wattroff(stdscr,a))
  200. #define    attrset(a)    CURVOID(wattrset(stdscr,a))
  201. #define    standout()    CURVOID(wattron(stdscr,A_STANDOUT))
  202. #define    standend()    CURVOID(wattroff(stdscr,A_STANDOUT))
  203. #define    wstandout(win)    CURVOID(wattron(win,A_STANDOUT))
  204. #define    wstandend(win)    CURVOID(wattroff(win,A_STANDOUT))
  205.  
  206. /*
  207.  * mv functions
  208.  */
  209. #define    mvwaddch(win,y,x,ch)    CURVOID(wmove(win,y,x)==ERR?ERR:waddch(win,ch))
  210. #define    mvwgetch(win,y,x)    CURVOID(wmove(win,y,x)==ERR?ERR:wgetch(win))
  211. #define    mvwaddstr(win,y,x,str)    CURVOID(wmove(win,y,x)==ERR?ERR:waddstr(win,str))
  212. #define mvwgetstr(win,y,x,str)  CURVOID(wmove(win,y,x)==ERR?ERR:wgetstr(win,str))
  213. #define    mvwinch(win,y,x)    CURVOID(wmove(win,y,x) == ERR ? ERR : winch(win))
  214. #define    mvwdelch(win,y,x)    CURVOID(wmove(win,y,x) == ERR ? ERR : wdelch(win))
  215. #define    mvwinsch(win,y,x,c)    CURVOID(wmove(win,y,x) == ERR ? ERR:winsch(win,c))
  216. #define    mvaddch(y,x,ch)        mvwaddch(stdscr,y,x,ch)
  217. #define    mvgetch(y,x)        mvwgetch(stdscr,y,x)
  218. #define    mvaddstr(y,x,str)    mvwaddstr(stdscr,y,x,str)
  219. #define mvgetstr(y,x,str)       mvwgetstr(stdscr,y,x,str)
  220. #define    mvinch(y,x)        mvwinch(stdscr,y,x)
  221. #define    mvdelch(y,x)        mvwdelch(stdscr,y,x)
  222. #define    mvinsch(y,x,c)        mvwinsch(stdscr,y,x,c)
  223.  
  224. /*
  225.  * psuedo functions
  226.  */
  227. #define    clearok(win,bf)     (win->_clear = bf)
  228. #define    leaveok(win,bf)     (win->_leave = bf)
  229. #define    scrollok(win,bf) (win->_scroll = bf)
  230. #define    keypad(win,bf)     (win->_keypad = bf)    
  231. #define flushok(win,bf)     (bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH))
  232. #define tscroll(win,bf)     (bf ? (win->_flags |= _VSCROLL):(win->_flags &= ~_VSCROLL))
  233. #define autoflush(bf)     (bf ? (curscr->_flags |= _FLUSH):(curscr->_flags &= ~_FLUSH))
  234. #define    getyx(win,y,x)     y = win->_cury, x = win->_curx
  235. #define getorg(win,y,x)  y = win->_begy, x = win->_begx
  236. #define getdim(win,y,x)  y = win->_maxy, x = win->_maxx
  237. #define is_standout(win) (win->_flags & A_STANDOUT)
  238. #define is_blinkon(win)     (win->_flags & A_BLINK)
  239. #define is_underlin(win) (win->_flags & A_UNDERLINE)
  240. #define is_attr1on(win)     (win->_flags & A_ATTR1)
  241. #define is_attr2on(win)     (win->_flags & A_ATTR2)
  242. #define is_attr3on(win)     (win->_flags & A_ATTR3)
  243. #define is_attr4on(win)     (win->_flags & A_ATTR4)
  244. #define is_attr5on(win)     (win->_flags & A_ATTR5)
  245. #define is_attr6on(win)     (win->_flags & A_ATTR6)
  246. #define is_attr7on(win)     (win->_flags & A_ATTR7)
  247. #define is_attr8on(win)     (win->_flags & A_ATTR8)
  248. #define is_curoff()     (curscr->_flags & _CUROFF)
  249. #define    winch(win)     (win->_y[win->_cury][win->_curx])
  250.  
  251. #define is_delok(w)     (DL&&((w->_flags & _VSCROLL)||((w->_maxx==COLS)&&((w->_begy+w->_maxy)==LINES))))
  252.  
  253. #define is_insok(w)     (AL&&((w->_flags & _VSCROLL)||((w->_maxx==COLS)&&((w->_begy+w->_maxy)==LINES))))
  254.  
  255. #define PROCMDS        2
  256. #define KEY_UNUSED    (-1)
  257.  
  258. /*
  259.  *    System V Release 2 curses function key defines 
  260.  */
  261.  
  262. #define KEY_BREAK    0401        /* break key (unreliable)  */
  263. #define KEY_DOWN    0402        /* The four arrow keys ...  */
  264. #define KEY_UP        0403
  265. #define KEY_LEFT    0404
  266. #define KEY_RIGHT    0405        /* ...  */
  267. #define KEY_HOME    0406        /* Home key (upward+left arrow)  */
  268. #define KEY_BS        0407        /* backspace (unreliable)  */
  269. #define KEY_F0        0410        /* Function keys.  Space for 64  */
  270. #define KEY_F(n)    (KEY_F0+(n))    /* keys is reserved.  */
  271. #define KEY_DL        0510        /* Delete line  */
  272. #define KEY_IL        0511        /* Insert line  */
  273. #define KEY_DC        0512        /* Delete character  */
  274. #define KEY_IC        0513        /* Insert char or enter insert mode  */
  275. #define KEY_EIC        0514        /* Exit insert char mode  */
  276. #define KEY_CLEAR    0515        /* Clear screen  */
  277. #define KEY_EOS        0516        /* Clear to end of screen  */
  278. #define KEY_EOL        0517        /* Clear to end of line  */
  279. #define KEY_SF        0520        /* Scroll 1 line forward  */
  280. #define KEY_SR        0521        /* Scroll 1 line backwards (reverse)  */
  281. #define KEY_NPAGE    0522        /* Next page  */
  282. #define KEY_PPAGE    0523        /* Previous page  */
  283. #define KEY_STAB    0524        /* Set tab  */
  284. #define KEY_CTAB    0525        /* Clear tab  */
  285. #define KEY_CATAB    0526        /* Clear all tabs  */
  286. #define KEY_ENTER    0527        /* Enter or send (unreliable)  */
  287. #define KEY_SRESET    0530        /* soft (partial) reset (unreliable)  */
  288. #define KEY_RESET    0531        /* reset or hard reset (unreliable)  */
  289. #define KEY_PRINT    0532        /* print or copy  */
  290. #define KEY_LL        0533        /* home down or bottom (lower left)  */
  291.                     /* The keypad is arranged like this:  */
  292.                     /* a1    up    a3    */
  293.                     /* left   b2  right   */
  294.                     /* c1   down   c3    */
  295. #define KEY_A1        0534        /* upper left of keypad  */
  296. #define KEY_A3        0535        /* upper right of keypad  */
  297. #define KEY_B2        0536        /* center of keypad  */
  298. #define KEY_C1        0537        /* lower left of keypad  */
  299. #define KEY_C3        0540        /* lower right of keypad  */
  300. #define KEY_BACKSPACE KEY_BS
  301.  
  302. #pragma    pack()
  303.  
  304. #endif    /* _TCAP_H  */
  305. #endif
  306.